<template>
<div id="app">
	<navigation title="" />
	<keep-alive>
		<router-view :key="key" />
	</keep-alive>
</div>
</template>

<script>
import navigation from '@/components/navigation.vue'
export default {
	components: {
		navigation,
	},
	data: () => ({}),
	methods: {},
	mounted() {
		// 非生产环境辅助调试
		if (!ENV.PRODUCTION) {
			window.vm = this
		}
	},
	computed: {
		key() {
			// 每次都刷新
			// return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date()
			// 根据页面刷新
			return this.$route.name !== undefined ? this.$route.name : this.$route
		}
	}
}

// 测试环境初始化
if (!ENV.PRODUCTION) {
	// 给IOS端的傻吊微信提前添加底部横条
	window.history.pushState(null, null, '#');
	// 应用环境信息输出
	console.log('[开发环境] ' + ENV.NODE_ENV);
	console.log('[项目名称] ' + ENV.projectName);
	console.log('[项目版本] ' + ENV.version);
	console.log('[API接口] ' + ENV.hosturl);
}

// 定义一些全局状态&变量的默认状态
let initialValueList = {
	// 用户信息
	user: '{"openid":null}',
}
for (let obj in initialValueList) {
	if (sessionStorage.getItem(obj) === null) {
		sessionStorage.setItem(obj, initialValueList[obj])
	}
}
</script>

<style lang="scss">
// Style
@import '../node_modules/@mdi/font/css/materialdesignicons.min.css';
@import '../node_modules/material-design-icons/iconfont/material-icons.css';
@import '../node_modules/font-awesome/css/font-awesome.min.css';
@import '../node_modules/cropperjs/dist/cropper.min.css';
// Muse-UI
@import '../node_modules/muse-ui/dist/muse-ui.css';
// iView
@import '../node_modules/iview/dist/styles/iview.css';
// swiper
@import '../node_modules/swiper/dist/css/swiper.min.css';
// alertify.js
@import '../node_modules/alertify.js/dist/css/alertify.css';
// animate.css
@import '../node_modules/animate.css/animate.min.css';
</style>

<style lang="scss">
// moem-common-scss
@import '@/assets/moem-common-scss/reset.scss';
@import '@/assets/moem-common-scss/main.scss';
// 修正型覆盖类全局Style
@import '@/assets/scss/reset.scss';
@import '@/assets/scss/common.scss';
</style>
